package com.bitin.adorn.modules.user.domain;

import com.bitin.adorn.common.enumeration.Gender;
import com.bitin.adorn.common.orm.domain.Email;
import com.bitin.adorn.common.orm.domain.Phone;
import jakarta.persistence.*;
import lombok.*;
import org.springframework.data.jpa.domain.AbstractAuditable;

/**
 * @Author: Mr.Lu
 * @Datetime 2024/8/29 22:24
 */

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "user")
public class User extends AbstractAuditable<User, String> {
    /**
     * 用户名
     */
    private String username;
    /**
     * 密码
     */
    private String password;
    /**
     * 昵称
     */
    private String nickname;
    /**
     * 用户头像
     */
    private String avatar;
    /**
     * 性别
     */
    @Enumerated(EnumType.STRING)
    private Gender gender;
    /**
     * 联系方式
     */
    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name = "value", column = @Column(name = "mobile", unique = true, nullable = false, length = 11))
    })
    private Phone phone;
    /**
     * 电子邮件
     */
    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name = "value", column = @Column(name = "email", unique = true, nullable = false, length = 128))
    })
    private Email email;
    /**
     * 状态((1-正常 0-禁用)
     */
    private Integer state;
}
